﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace HelloWPF.DataBinding
{
    /// <summary>
    /// DataContextDataBinding.xaml 的交互逻辑
    /// </summary>
    public partial class DataContextDataBinding : Window
    {
        public DataContextDataBinding()
        {
            InitializeComponent();
            tb.DataContext = new Student() { Student_Name = "张三"};
            tb2.DataContext = new Student() { Student_Age = 32.2 };
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            
        }
    }

    public class Student
    {
        private string _student_Name;
        public string Student_Name
        {
            get { return _student_Name; }
            set
            {
                _student_Name = value;
            }
        }

        private double? _student_Age;
        public double? Student_Age
        {
            get { return _student_Age; }
            set
            {
                _student_Age = value;
            }
        }
    }
}
